package com.hmxx.myblogproject.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.github.pagehelper.PageHelper;
import com.hmxx.myblogproject.entity.MyBlogTitles;
import com.hmxx.myblogproject.service.MyBlogTitlesService;
import com.hmxx.myblogproject.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @description:
 * @Author: {27106}
 * @Date: {2021/11/18 9:32}
 */
@RestController
@RequestMapping("/titles")
public class MyBlogTitlesController {
    @Resource
    private MyBlogTitlesService service;


    @GetMapping("/getList")
    public Object getTitleList(Integer page,Integer limit,String tagName){
        return service.getTitlesList(page,limit,tagName);
    }

    @PostMapping("/searchTitleList")
    public Object searchTitleList(@RequestBody String json){
        return service.searchTitleList(json);
    }


    @GetMapping("/getTitlesByUid")
    public Object getTitlesByUid(String username){
        return service.getTitlesByUid(username);
    }

    @PostMapping("/postTitle")
    public Object postTitle(@RequestBody String json, HttpServletRequest request){
        return service.postTitle(json,request);
    }

    @GetMapping("/getTitleById")
    public Object getTitleById(String id){
        return service.getTitleInfo(id);
    }

    @GetMapping("/getTitleAndBlog")
    public Object getTitleAndBlog(String id){
        return service.getTitleAndBlog(id);
    }

    @PostMapping("/modifyTitle")
    public Object modifyTitle(@RequestBody String json, HttpServletRequest request){

        return service.modifyTitle(json,request);
    }

    @PostMapping("/delTitleById")
    public Object delTitleById(@RequestBody String json){

        return service.delTitleById(json);
    }

}
